﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Ebc.DesignerDsl
{
    public partial class EbcDesignerDslSerializationHelper
    {
        protected override void CheckVersion(Microsoft.VisualStudio.Modeling.SerializationContext serializationContext, System.Xml.XmlReader reader)
        {
            #region Check Parameters
            global::System.Diagnostics.Debug.Assert(serializationContext != null);
            if (serializationContext == null)
                throw new global::System.ArgumentNullException("serializationContext");
            global::System.Diagnostics.Debug.Assert(reader != null);
            if (reader == null)
                throw new global::System.ArgumentNullException("reader");
            #endregion

            global::System.Version expectedVersion = new global::System.Version("1.0.5.0");
            string dslVersionStr = reader.GetAttribute("dslVersion");
            if (dslVersionStr != null)
            {
                try
                {
                    global::System.Version actualVersion = new global::System.Version(dslVersionStr);
                    if (actualVersion.Major != expectedVersion.Major)
                    {
                        EbcDesignerDslSerializationBehaviorSerializationMessages.VersionMismatch(serializationContext, reader, expectedVersion, actualVersion);
                    }
                }
                catch (global::System.ArgumentException)
                {
                    EbcDesignerDslSerializationBehaviorSerializationMessages.InvalidPropertyValue(serializationContext, reader, "dslVersion", typeof(global::System.Version), dslVersionStr);
                }
                catch (global::System.FormatException)
                {
                    EbcDesignerDslSerializationBehaviorSerializationMessages.InvalidPropertyValue(serializationContext, reader, "dslVersion", typeof(global::System.Version), dslVersionStr);
                }
                catch (global::System.OverflowException)
                {
                    EbcDesignerDslSerializationBehaviorSerializationMessages.InvalidPropertyValue(serializationContext, reader, "dslVersion", typeof(global::System.Version), dslVersionStr);
                }
            }
        }
    }
}